package com.wx.controller;

import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping("anno")
public class WechatEditorController {

	@RequestMapping("weditor")
	public String index(){
		return "article/article_editor";
	}
	
	@RequestMapping("wres/{page}")
	public String include(@PathVariable String page, Model model,HttpServletRequest request){
		int port = request.getServerPort();
		String basePath = request.getScheme()+"://"+request.getServerName();
		if(port!=80){
			basePath=basePath+":"+port;
		}
		basePath += request.getContextPath();
		model.addAttribute("basePath", basePath);
		return "article/tab/"+page;
	}
	
	@RequestMapping("leditor")
	public String innerIndex(){
		return "article/left_editor";
	}
}
